/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cr.ac.una.sive.entidad;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author claribel
 */
@Entity
@Table(name = "RESERVACION_EVENTO", catalog = "", schema = "UNA_SIVE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ReservacionEvento.findAll", query = "SELECT r FROM ReservacionEvento r"),
    @NamedQuery(name = "ReservacionEvento.findByIdReservacionEvento", query = "SELECT r FROM ReservacionEvento r WHERE r.idReservacionEvento = :idReservacionEvento"),
    @NamedQuery(name = "ReservacionEvento.findByNombreEvento", query = "SELECT r FROM ReservacionEvento r WHERE r.nombreEvento = :nombreEvento"),
    @NamedQuery(name = "ReservacionEvento.findByDescripcion", query = "SELECT r FROM ReservacionEvento r WHERE r.descripcion = :descripcion"),
    @NamedQuery(name = "ReservacionEvento.findByRangoInicial", query = "SELECT r FROM ReservacionEvento r WHERE r.rangoInicial = :rangoInicial"),
    @NamedQuery(name = "ReservacionEvento.findByRangoFinal", query = "SELECT r FROM ReservacionEvento r WHERE r.rangoFinal = :rangoFinal"),
    @NamedQuery(name = "ReservacionEvento.findByCantidadEspacios", query = "SELECT r FROM ReservacionEvento r WHERE r.cantidadEspacios = :cantidadEspacios")})
public class ReservacionEvento implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "SQRESERVACION_EVENTO")
    @SequenceGenerator(name="SQRESERVACION_EVENTO", sequenceName = "SQ_RESERVACION_EVENTO",allocationSize=1)
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID_RESERVACION_EVENTO", nullable = false, precision = 0, scale = -127)
    private BigDecimal idReservacionEvento;
    @Size(max = 100)
    @Column(name = "NOMBRE_EVENTO", length = 100)
    private String nombreEvento;
    @Size(max = 255)
    @Column(name = "DESCRIPCION", length = 255)
    private String descripcion;
    @Column(name = "RANGO_INICIAL")
    private BigInteger rangoInicial;
    @Column(name = "RANGO_FINAL")
    private BigInteger rangoFinal;
    @Column(name = "CANTIDAD_ESPACIOS")
    private BigInteger cantidadEspacios;
    @OneToMany(cascade= CascadeType.ALL,mappedBy = "reservacionEvento", fetch = FetchType.EAGER)
    private Collection<RegistroPlacaEvento> registroPlacaEventoCollection;
    @OneToMany(cascade= CascadeType.ALL,mappedBy = "reservacionEvento", fetch = FetchType.EAGER)
    private Collection<HorarioReservacionEvento> horarioReservacionEventoCollection;

    public ReservacionEvento() {
    }

    public ReservacionEvento(BigDecimal idReservacionEvento) {
        this.idReservacionEvento = idReservacionEvento;
    }

    public BigDecimal getIdReservacionEvento() {
        return idReservacionEvento;
    }

    public void setIdReservacionEvento(BigDecimal idReservacionEvento) {
        this.idReservacionEvento = idReservacionEvento;
    }

    public String getNombreEvento() {
        return nombreEvento;
    }

    public void setNombreEvento(String nombreEvento) {
        this.nombreEvento = nombreEvento;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public BigInteger getRangoInicial() {
        return rangoInicial;
    }

    public void setRangoInicial(BigInteger rangoInicial) {
        this.rangoInicial = rangoInicial;
    }

    public BigInteger getRangoFinal() {
        return rangoFinal;
    }

    public void setRangoFinal(BigInteger rangoFinal) {
        this.rangoFinal = rangoFinal;
    }

    public BigInteger getCantidadEspacios() {
        return cantidadEspacios;
    }

    public void setCantidadEspacios(BigInteger cantidadEspacios) {
        this.cantidadEspacios = cantidadEspacios;
    }

    @XmlTransient
    public Collection<RegistroPlacaEvento> getRegistroPlacaEventoCollection() {
        return registroPlacaEventoCollection;
    }

    public void setRegistroPlacaEventoCollection(Collection<RegistroPlacaEvento> registroPlacaEventoCollection) {
        this.registroPlacaEventoCollection = registroPlacaEventoCollection;
    }

    @XmlTransient
    public Collection<HorarioReservacionEvento> getHorarioReservacionEventoCollection() {
        return horarioReservacionEventoCollection;
    }

    public void setHorarioReservacionEventoCollection(Collection<HorarioReservacionEvento> horarioReservacionEventoCollection) {
        this.horarioReservacionEventoCollection = horarioReservacionEventoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idReservacionEvento != null ? idReservacionEvento.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ReservacionEvento)) {
            return false;
        }
        ReservacionEvento other = (ReservacionEvento) object;
        if ((this.idReservacionEvento == null && other.idReservacionEvento != null) || (this.idReservacionEvento != null && !this.idReservacionEvento.equals(other.idReservacionEvento))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cr.ac.una.sive.entidad.ReservacionEvento[ idReservacionEvento=" + idReservacionEvento + " ]";
    }
    
}
